﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using DomainDriver.CommonUtilities.Enums;
using DomainDriver.DomainModeling.DataProviders;
using DomainDriver.DomainModeling.GenericUnitTesting.Constraints;
using AutomotivePricingModel.TransmissionTypes;

namespace AutomotivePricingModel.UnitTests.FixedValuesConstraints
{
    [TestFixture(new object[] { DataSourcePersistenceType.None })]
    [TestFixture(new object[] { DataSourcePersistenceType.File })]
    [TestFixture(new object[] { DataSourcePersistenceType.Database })]
    public class TransmissionTypeFixedValuesConstraintTests : FixedValuesConstraintTestFixture<AutomotivePricingDomainModel, TransmissionTypeEnum, TransmissionType>
    {
        public TransmissionTypeFixedValuesConstraintTests(DataSourcePersistenceType persistenceType)
            : base(persistenceType)
        { }

        protected override AutomotivePricingDomainModel CreateDomainModel(DataSourcePersistenceType persistenceType, bool buildModelWithConstraints)
        {
            AutomotivePricingDomainModel model = new AutomotivePricingDomainModel(persistenceType, buildModelWithConstraints);
            return model;
        }

        protected override int GetNumberOfExpectedObjectsLoadedInSetup()
        {
            return Enum.GetValues(typeof(TransmissionTypeEnum)).Length;
        }

        protected override TransmissionType CreateDomainObjectForFalseEnumValue()
        {
            int falseIntValue = EnumUtilities.GetMaxEnumValue<TransmissionTypeEnum>() + 1;
            TransmissionTypeEnum falseKeyValue = (TransmissionTypeEnum)falseIntValue;
            TransmissionType falseDomainObject = new TransmissionType(falseKeyValue);
            return falseDomainObject;
        }

        protected override void UpdateDomainObject(TransmissionType domainObject, ref bool objectCanBeUpdated)
        {
            objectCanBeUpdated = true;
            domainObject.DisplayName += "UPDATED";
        }
    }
}